/*!
 * SPDX-License-Identifier: Apache-2.0
 *
 * The OpenSearch Contributors require contributions made to
 * this file be licensed under the Apache-2.0 license or a
 * compatible open source license.
 *
 * Modifications Copyright OpenSearch Contributors. See
 * GitHub history for details.
 */

/*
 * 1. Fix for Safari to ensure that it renders like a normal text input
 *    and doesn't add extra spacing around text
 * 2. Remove the X clear button from input type search in Chrome and IE
*/

.ouiFieldSearch {
  @include ouiFormControlStyle;
  @include ouiFormControlWithIcon($isIconOptional: false);
  @include ouiFormControlIsLoading;

  // sass-lint:disable-block no-vendor-prefixes
  -webkit-appearance: textfield; /* 1 */

  &::-webkit-search-decoration,
  &::-webkit-search-cancel-button {
    -webkit-appearance: none;  /* 1, 2 */
  }

  &::-ms-clear {
    display: none; /* 2 */
  }

  &.ouiFieldSearch-isClearable {
    @include ouiFormControlLayoutPadding(1)
  }

  &.ouiFieldSearch-isLoading {
    @include ouiFormControlLayoutPadding(1);
  }

  &.ouiFieldSearch-isLoading.ouiFieldSearch-isClearable {
    @include ouiFormControlLayoutPadding(2);
  }

  &.ouiFieldSearch--compressed {
    @include ouiFormControlWithIcon($isIconOptional: false, $side: 'left', $compressed: true);

    &.ouiFieldSearch-isClearable {
      @include ouiFormControlLayoutPadding(1, $compressed: true);
    }

    &.ouiFieldSearch-isLoading {
      @include ouiFormControlLayoutPadding(1, $compressed: true);
    }

    &.ouiFieldSearch-isLoading.ouiFieldSearch-isClearable {
      @include ouiFormControlLayoutPadding(2, $compressed: true);
    }
  }
}
